<?
	include_once(dirname(__FILE__).'/../../bootstrap/unit.php');
	include_once('bootstrap.php');

	//Test registers a menu item
	$params["category"] = "Your Account2";
	$params["item_name"] = "Change Password";
	$params["lang"] = 'en';
	$params["url"] = '/test';
	$params["keywords"][0] = "password";
	$params["keywords"][1] = "change";

	//Erase the plugin def for the plugin if it exists
	$q = Doctrine_Query::create()
		->select("menu_id")
		->from("bjMenuItem b")
		->leftJoin("b.Translation t")
		->addwhere("t.menu_item_name = ?", $params["item_name"])
		->setHydrationMode(Doctrine::HYDRATE_ARRAY)
		->fetchOne();
	
	$q = Doctrine_Query::create()
		->delete("bjMenuItem")
		->addwhere("menu_id = ?", $q["menu_id"])
		->execute();
	
	$manager = 	bjMenuManager::getInstance();

	$result = $manager->register($params);
	
	
	$t->cmp_ok($result["errorCode"], '==', '1', 'Tests that the menu item has been registered: '.$result["msg"]);

	$result = $manager->register($params);
	
	$t->cmp_ok($result["errorCode"], '==', '-2', 'Tests that the menu item cannot be overridden: '.$result["msg"]);

	
?>